package com.example.forum.dao;

import com.example.forum.model.Message;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface MessageMapper {
    int insert(Message message);

    int insertSelective(Message message);

    Message selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Message message);

    int updateByPrimaryKey(Message message);


    /**
     * Created by hanzishuai on 2025/4/13
     *
     * @param receiveUserId 用户Id
     * @return java.lang.Integer 未读数量
     * @Description 根据用户Id查询该用户未读数量
     */
    Integer selectUnreadCount(@Param("receiveUserId") Long receiveUserId);


    /**
     * Created by hanzishuai on 2025/4/13
     * @param receiveUserId 接收方用户Id
     * @return java.util.List<com.example.forum.model.Message>
     * @Description  根据接收者用户Id查询所有站内信
     */
    List<Message> selectByReceiveUserId(@Param("receiveUserId") Long receiveUserId);

}











